package com.offcn.user.controller;

import com.offcn.user.pojo.TMember;
import com.offcn.user.service.UserService;
import com.offcn.user.vo.resp.UserRespVo;
import com.offcn.dycommon.response.AppResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: wzy
 * @Date: 2021/01/24/16:11
 * @Description:
 */
@RestController
@Api(tags = "用户模块")
public class UserController {
    @Autowired
    private UserService userService;

    @ApiOperation("根据用户编号查询用户信息")
    @ApiImplicitParam(name = "id", value = "用户id", required = true)
    @GetMapping("/findUserById/{id}")
    public AppResponse<UserRespVo> findUser(@PathVariable("id") Integer id) {
        TMember member = userService.findTMemberById(id);
        UserRespVo userRespVo = new UserRespVo();
        BeanUtils.copyProperties(member, userRespVo);
        return AppResponse.ok(userRespVo);

    }
}
